MAC layer timestamping approach for emerging wireless sensor platform and communication architecture

ABSTRACT

In the receiving side MAC layer timestamping approach, the MPDU structure is changed by adding an extra timestamping field. When a MPDU packet is generated, a captured receiving timestamp is written into the MPDU&#39;s timestamp field. The MPDU packet is then forwarded from the PHY to the MAC layer of the wireless sensor node. In the MAC layer, the receiving timestamp is further processed and inserted into a corresponding field of the time synchronization message, which is in turn transmitted to a Time Synchronization module. In the sending side MAC layer timestamping approach, the sending timestamp is captured immediately before the time synchronization message is written into TxFIFO.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to methods and apparatus for MAC-layertimestamping in a wireless sensor platform.

2. Description of the Related Art

The present invention incorporates by reference the followingpublications:

[1] IEEE Standard for Information technology, Part 15.4: Wireless MediumAccess Control (MAC) and Physical Layer (PHY) Specifications forLow-Rate Wireless Personal Area Networks (WPANs); and

[2] Time Synchronization Module S/W Detailed Level Design Version 1.1 bySamsung Telecommunications America.

TinyOS-based Wireless Sensor Networks (WSNs) are transitioning toreal-world applications (e.g. TinyDB, Arch Rock Primer Pack/IP, CrossbowWireless Sensor Network), and expected to become more prevalent in oureveryday life. The values of WSN reply on their low energy consumption,low cost, easy deployment, and interoperability in large numbers. Toachieve these, new devices and new communication stacks are beingdeveloped. Recently, a few of vendors have released 8051-based System ona Chip (SoC) sensor motes (e.g TI CC2430/MicrotrollerUnit (MCU) 8051,CC2431/MCU8051), which combines radio and MCU at low cost. Due to thenew release, TinyOS community formed a new working group, “TinyOS 8051Working Group” in March, 2005 and is working on porting NesC and TinyOSto the 8051 microcontroller platform.

To support the interoperability, low cost, and low power consumptionrequirements, a new IEEE 802.15.4 standard has also been proposedrecently. The IEEE 802.15.4 standard defines the physical and mediumaccess layer (MAC) for wireless personal area networks (WPANs). The IEEE802.15.4 standard is compliant with Zigbee. The ZigBee Alliance—anorganization with more than 150 company members—has been working inconjunction with the IEEE Task Group 15.4 in order to specify a fullprotocol stack for WPANs. So IEEE 802.15.4 is establishing its place onthe market as enablers of the pervasive, interoperable wireless sensornetworks (WSNs).

The emerging new devices (8051 platform) and new communication stacks(802.15.4) bring new challenges to TinyOS-based WSN, especially forMAC-layer timestamping based time synchronization. The MAC-layertimestamping based time synchronization is both hardware-dependent andMAC/Physical Layer (PHY)-layer dependent. Time synchronization (TS) is acritical piece of infrastructure for WSN. Many applications in WSN needsynchronized time (for data fusion, TDMA schedules, synchronized sleepperiods, etc.). To meet the high-accuracy synchronization requirement,MAC layer timestamping is needed to eliminate and reducenon-deterministic factors. In MAC-layer timestamping based timesynchronization, Time Synchronization module directly time-stampspackets at the MAC/PHY layer, thus the non-determinism of send and/orreceive time can be reduced, resulting in high precision performance.

All previous works (e.g. Flooding Time Synchronization Protocol (FTSP)on Mica and Telos) realizes MAC-layer timestamping only on Mica Atmel(AVR) MCU platform and Telos TI MSP430 MCU platform and only throughTinyOS default communication stack. The existing approaches forMAC-layer times-stamping are not applicable to the WSN with the newhardware and new 802.15.4 stack. In addition, traditional MAC-layerstamping approaches have been only tested on the application with onesingle Time Synchronization module, not in a large software system withmultiple modules and multiple messaging. The traditional MAC-layerstamping approach is not scalable. In the traditional MAC-layertimestamping approach, Start-of-frame delimiter (SFD) signal events arecreated for every sent/received message in the interrupt handlingcontext, and are directly given to time synchronization module forfurther processing. If there are multiple modules in a large softwaresystem and multiple messaging (e.g. a lot of broadcast messages), everynode may receive/send multiple messages in a very short time and the SFDsignal event in the interrupt context will be created for everysent/received message. In this case, the code needed to run in theinterrupt handlers will be too large, the interrupts will be lost orqueued, which eventually affects the whole system stability and resultsin node hanging in the worst case.

SUMMARY OF THE INVENTION

It is therefore an object of the present invention to provide animproved method and apparatus for MAC-layer timestamping.

It is another object of the present invention to provide an improvedmethod and apparatus for MAC-layer timestamping that is compatible withthe new software and hardware platform.

It is still another object of the present invention to provide animproved method and apparatus for timestamping with minimum performanceoverhead.

According to one aspect of the present invention, a message is receivedat a physical layer (PHY) of a wireless node. The message includes aStart-of-Frame-Delimiter field. A receiving timestamp is captured at theend of receiving the Start-of-Frame-Delimiter field when a SFD interruptis created. A medium access control (MAC) protocol data unit (MPDU)packet is generated to include the message and a timestamping field. Thecaptured receiving timestamp is inserted into the timestamping field ofthe medium access control protocol data unit (MPDU) packet, which issubsequently forwarded from the physical layer (PHY) of the wirelesssensor node to the medium access control (MAC) layer of the wirelesssensor node. In the medium access control (MAC) layer, it is determinedwhether the message in the medium access control protocol data unit(MPDU) packet is a time synchronization message. If the message in thedata packet is a time synchronization message, the receiving timestampis inserted into a timestamping field of the time synchronizationmessage. Finally, the time synchronization message is transmitted fromthe medium access control (MAC) layer of the wireless sensor node to aTime Synchronization module (TSM) of the wireless sensor node.

According to another aspect of the present invention, a timesynchronization message is generated at a wireless sensor node in awireless network. When the time synchronization message is to be writteninto the TxFIFO data buffer of the wireless sensor node, a sendingtimestamp is captured and embedded into the time synchronization messageright before the time synchronization message is written into the TxFIFOdata buffer. The time synchronization message embedded with the sendingtimestamp is then sent out from the TxFIFO buffer of a wireless sensornode.

BRIEF DESCRIPTION OF THE DRAWINGS

A more complete appreciation of the invention and many of the attendantadvantages thereof, will be readily apparent as the same becomes betterunderstood by reference to the following detailed description whenconsidered in conjunction with the accompanying drawings in which likereference symbols indicate the same or similar components, wherein:

FIG. 1 schematically illustrates the block architecture of a softwaresystem in a sensor node in a Ubiquitous Sensor Network (USN);

FIG. 2 schematically illustrates the structure of network stack of theUMR software system;

FIG. 3 schematically illustrates the structure of the MAC-layer dataframe and the PHY packet;

FIG. 4 is a flow chart outlining a sending process for a traditional MAClayer time-stamping approach using TinyOS default stack;

FIG. 5 is a flow chart outlining a receiving process for a traditionalMAC layer time-stamping approach using TinyOS default stack;

FIG. 6 is a flow chart outlining a sending process for the MAC layertime-stamping approach as an embodiment according to the principles ofthe present invention;

FIG. 7 schematically illustrates the new structure of the MPDU packetaccording to the principles of the present invention;

FIG. 8 schematically illustrates an example of a time synchronizationmessage structure, which includes Global Timestamp and Local Timestampfields;

FIG. 9 is a flow chart outlining a receiving process for thetime-stamping approach as an embodiment according to the principles ofthe present invention;

FIG. 10 schematically illustrates the entire sending-receiving chain inthe new MAC-layer timestamping mechanism according to the principles ofthe present invention;

FIG. 11 schematically illustrates a system for performing a stabilitytest; and

FIG. 12 schematically illustrates major components within a wirelesssensor node for implementing the MAC-layer timestamping method as anembodiment according to the principles of the present invention.

DETAILED DESCRIPTION OF THE EMBODIMENTS

FIG. 1 schematically illustrates the block architecture of a UbiquitousSensor Network (USN) Mesh/Relay (UMR) software system we implemented ina sensor node. The UMR software system is developed for USN to provideintelligent, efficient, reliable and scalable USN networking frameworkusing Topology control, Mesh Routing, Multi-hop Data Relaying, DataCentric Forwarding, and Time Synchronization based on IEEE 802.15.4 andTinyOS technologies. As shown in FIG. 1, a sensor node is constructedwith UMR software system 110. Network Topology Control module 112 is incharge of topology formation and connectivity of sensor nodes, andprovides the topology information that will be used by Mesh Routingmodule 114 of the sensor network. Mesh Routing module 114 is in chargeof the route discovery, recovery and optimization. Multi-hop DataRelaying module 116 is in charge of the classification of Medium AccessControl (MAC) frames and Adaptive Link Control (ALC) between sensornodes. These functions provide the redistribution of up-link MAC framesfrom MAC layer and the reliable transport based on link quality andapplication data information. Data Centric Forwarding module 118 is usedfor sensor data aggregation. Time Synchronization module 120 is used fortime synchronization to providing Network Time (or Global time) serviceto sensor nodes based on local time at the Sink node.

FIG. 2 schematically illustrates the structure of network stack of theUMR software system. As shown in FIG. 2, Topology Control module 112,Mesh Routing module 114, Data Centric Forwarding module 118, and Timesynchronization module 120 are located in network layer 130, andcommunicate with MAC layer 140 via Multi-hop Data Relaying module 116located in network layer 130.

Before we start explaining the sending-receiving process of theMAC-layer timestamping approach, we will first introduce framestructures. In the IEEE 802.15.4 standard, frame structures have beendesigned to keep the complexity to a minimum while at the same timemaking them sufficiently robust for transmission on a noisy channel.Each successive protocol layer adds to the structure with layer-specificheaders and footers. According to the IEEE 802.15.4 standard, a dataframe is used for the transfer of data.

FIG. 3 schematically illustrates the structure of the MAC layer dataframe, which originates from the upper layers (e.g. network layer orapplication layer). The data payload is passed to the MAC sublayer andis referred to as the MAC service data unit (MSDU). The MAC payload isprefixed with a MAC header (MHR) and appended with an MFR). The MHRcontains the Frame Control field, data sequence number (DSN), addressingfields, and optionally the auxiliary security header. The MFR iscomposed of a 16-bit FCS. The MHR, MAC payload, and MFR together formthe MAC data frame, (i.e., MPDU). The MPDU is passed to the PHY as thePSDU, which becomes the PHY payload. The PHY payload is prefixed with asynchronization header (SHR), containing the Preamble Sequence andStart-of-frame delimiter (SFD) fields, and a PHY header (PHR) containingthe length of the PHY payload in octets. The preamble sequence and thedata SFD enable the receiver to achieve symbol synchronization. The SHR,PHR, and PHY payload together form the PHY packet, (i.e., PPDU).

FIG. 4 is a flow chart outlining a sending process for a traditional MAClayer time-stamping approach using TinyOS default stack. First, a timesynchronization message is generated by the time synchronization moduleof a wireless sensor node and is transmitted to its MAC layer. The MAClayer then transmits the time synchronization message to the Physical(PHY) layer via step 210. When the PHY layer receives the timesynchronization message via step 212, the PHY Layer writes the messageto a TxFIFO data buffer via step 214. The node observes a channelcondition, and when the channel is clear, the node starts sending thepreamble and the SFD via step 216. Immediately after the SFD field istransmitted, a sending SFD interrupt is created. A SFD interrupt is ahardware interrupt which triggers the lowest level event in TinyOSsystems. When the sending SFD interrupt is created, the node captures atimestamp via step 218, and writes the captured timestamp into the timesynchronization message stored in the TxFIFO via step 220 by using afunction “writeToTxFIFO”. Then, the node transmits the timesynchronization message attached with the timestamp from the TxFIFO viastep 222.

We have tested the sending process of the traditional timestamp approachin a new platform with CC2431 as the Radio Chip, 8051MCU as theprocessor, and TinyOS 2.0 as the operating system. The new platform,however, does not support step 220, i.e., the functionality ofwriteToTxFIFO, thus resulting in the instability of the whole system.

FIG. 5 is a flow chart outlining a receiving process for the traditionalMAC-layer time-stamping approach using TinyOS default stack. When awireless node receives a time synchronization message, the message isreceived at the MAC/PHY layer via step 230. The MAC/PHY layer is theTinyOS default stack. Immediately after the SFD field of the timesynchronization message is received, a SFD interrupt is created, and areceiving timestamp is captured by the node via step 232. Then, a SFDsignal event will be created and signaled to the Time Synchronizationmodule (TSM) via step 234. The aim of the SFD signal event is to passthe captured receiving timestamp to the Time Synchronization module(TSM). In the signal event, the passed parameters include the capturedreceiving timestamp and a message pointer specifying to which messagethe timestamp corresponds. When the Time Synchronization module (TSM)receives the event, the Time Synchronization module (TSM) caches thecaptured receiving timestamp and the message pointer via step 236. Whenthe MAC/PHY layer forwards the received message to the TimeSynchronization module (TSM), the Time Synchronization Module (TSM)matches the received message with the cached timestamp by checking ifthe message pointer for the cached timestamp corresponds to the receivedmessage, via step 238.

The receiving process of the traditional time-stamping approach has thefollowing disadvantages. First, the SFD interrupt signal events areunder hardware context and preempt other tasks or interrupts. When alarge software system is constructed with multiple sub-modules, a lot ofmessages may be generated and need to be transmitted. A sensor node canreceive multiple messages in a very short time, thus creating a lot ofsignal events. This will preempt other tasks and hardware interrupts,and eventually will cause the whole system unstable or undesirably hangup.

We have developed a new MAC-layer-timestamping approach for the WSN withthe new hardware platform (MCU8051 platform, see Table 1) and the newTinyOS-2.0 based 802.15.4 stack. We identified the new hardware platformfeatures and boundaries, and designed the new MAC-layer timestampingapproach based on it. We implemented and tested the MAC-layertime-stamping approach using the Time Synchronization algorithm of ourData Centric Project.

TABLE 1 The New MAC layer Timestamping Hardware Platform. CategoryProcessor Board Note General Main Component CC2431 MCU + RF FeaturesTransceiver(SOC) Processor 8-bit 8051 OS TinyOS 2.0 Board Size 50 × 25mm Memory Internal Memory 128 KB Flash/8 KB SRAM External Memory 16 MbitEEPROM Serial Flash (SPI Interface) RF Frequency Range 2400~2483.5 MHzHeterodyne Receiver Transceiver Transmit Power 0 dBm (1 mW) Without PATransmit Data 250 kbps Rate Receiver −91 dBm Sensitivity AntennaExternal Dipole Antenna SMA type connector (2 dB) Range (LOS) 170 m Ref.CC2430 DBK Miscellaneous Current 26.9 mA Maximum. RF Consumption ActivePower Supply 2 × (1.5 V Battery) AA size Interface 40-pin connectorPower, Download, Debugging

The features of the new MAC-layer timestamping approach are:

-   -   The new MAC-layer timestamping approach is the first        implementation of MAC layer timestamping on TinyOS 2.0-based        IEEE 802.15.4 stack and MCU-8051 platform. The new MAC-layer        timestamping approach has minimum performance overhead, i.e., no        SFD signal events are created like traditional MAC layer        time-stamping approach. All the sending/receiving time-stampings        are embedded and written into packets within 802.15.4 layers.    -   The new MAC-layer timestamping approach is Zigbee protocol        compliant and support Zigbee protocols    -   The new MAC-layer timestamping approach is scalable. It has been        integrated into large UMR software system which consists of        multiple modules (e.g. Topology Control, Mesh Routing, Data        Centric Forwarding)

The specific details for the new MAC layer timestamping approach aredescribed as follows.

For the sending side MAC layer timestamping approach, we identified the8051 platform boundaries, and proposed a feasible approach forsending-side MAC layer timestamping. The traditional approach capturesthe sending timestamp when the SFD interrupt of a sending message iscreated and inserts the captured timestamp into the message being savedin TxFIFO. The current hardware platform, however, doesn't support thefunctionality of writeToTxFIFO since the functionality of writeToTxFIFOcauses the instability of the whole system.

Based on this, we proposed a new MAC layer timestamping approach for thesending side. That is, in the sending side's PHY layer, we add sendingtime stamp into the time synchronization message right before the timesynchronization message is written into the TxFIFO. Here, right beforerefers to immediately before, i.e., there is no interval of time betweenadding the sending time stamp into the time synchronization message andwriting the synchronization message into the TxFIFO. The sendingtimestamp is furthered corrected by applying statistical correction. Byusing this approach, the sending timestamp is directly embedded into themessage. We applied stability and stress test. This approach shows to bethe most stable approach in the current hardware platform.

Specifically, FIG. 6 illustrates a flow chart outlining a sending sideMAC layer time-stamping approach as an embodiment according to theprinciples of the present invention. First, a time synchronizationmessage is generated by the time synchronization module of a wirelesssensor node and is transmitted to the MAC layer. The MAC layer transmitsthe time synchronization message to the Physical (PHY) layer via step250. When the PHY layer receives the time synchronization message viastep 252, the node captures a sending timestamp right before the messageis written into the TxFIFO data buffer, via step 254. The node attachesthe captured sending timestamp into the message via step 256. Then, thePHY layer writes the message attached with the sending timestamp intothe TxFIFO 258. Finally, the node transmits the time synchronizationmessage attached with the timestamp from the TxFIFO via step 260.

For the receiving side MAC layer timestamping approach, different fromthe traditional MAC layer timestamping approach, our approach does notcreate a receiving SFD signal event for each received message, sincethis will cause too much performance overhead and eventually will causeinstability of the whole system. In our approach, a SFD receivingtimestamp is directly embedded into the IEEE 802.15.4 data packet and noextra process/task overhead is needed.

Specifically, this is realized as follows. First, we propose to changethe MAC Protocol Data Unit (MPDU) structure definition by adding anextra timestamping field into the MPDU structure definition. FIG. 7schematically illustrates the structure of the new MPDU packet accordingto the principles of the present invention. The new MPDU packetincludes, but not limited to, a Length field, a Frame Control field, aSequence Number field, a Data field and a Timestamp field.

Then, in the PHY layer, the receiving timestamp of a received message iscached/written into the MPDU packet's time-stamping field. When a MPDUpacket is transmitted from the PHY layer to the MAC layer, the timestampcached within MPDU can be further processed in MAC layer. The MAC layerchecks whether the message in the MPDU packet is a time synchronizationmessage. If the message is a time synchronization message, the receivingtimestamp is written into the corresponding field in the timesynchronization message.

FIG. 8 schematically illustrates the structure of a time synchronizationmessage used in our Data Centric Project. The time synchronizationmessage includes a Global Timestamp field, and a Local Timestamp field.The TSM we implemented in the UMR software system supports multi-hopsynchronization. The root of the network, the sink node (SINK),maintains the global time and all other nodes synchronize their clocksto that of the SINK. The TSM utilizes a broadcast message to synchronizethe possibly multiple receivers to the time provided by the sender ofthe message. The broadcasted message contains the sender's time stampwhich is the estimated global time (global timestamp) at thetransmission of the given message. The receivers obtain thecorresponding local time (local timestamp) from their respective localclocks at message reception. Consequently, one broadcast messageprovides a synchronization point (a global-local time pair) to each ofthe receivers. When a sender periodically broadcasts a timesynchronization message, each receiver caches multiple synchronizationpoints and performs linear regression based on the cached multiplesynchronization points to estimate its clock's skew and an offset. Therelationship between local time and global time based on the estimatedskew and offset is represented as follows:Global_time=Skew×Local_time+Offset  (1)By using the estimated skew and offset, a node can covert its local timeto global time.

FIG. 9 is a flow chart outlining a receiving process for thetime-stamping approach as an embodiment according to the principles ofthe present invention. When a wireless node receives a timesynchronization message, the message is received at the PHY layer viastep 270. Immediately after the SFD field of the time synchronizationmessage is received, a SFD interrupt is created, and a receivingtimestamp is captured via step 272. Then, a MPDU packet is formed toinclude the received message, and the captured receiving timestamp viastep 274. Note that the MPDU packet in the present invention includes atimestamping field. The PHY layer subsequently forwards the MPDU packetto the MAC layer via step 276. In the MAC layer, the received messageand the receiving timestamp contained in the MPDU packet are extracted,and a determination is made about whether the extracted message is atime synchronization message via step 278. If the received message is atime synchronization message, the receiving timestamp is written intothe corresponding field of the time synchronization message via step280. Finally, the received message extracted from the MPDU packet isforwarded from the MAC layer to an upper layer corresponding module viastep 282. In the case that the received message is the timesynchronization message, the time synchronization message is forwardedto the Time Synchronization module via step 282.

By using the above process, when the Time Synchronization modulereceives a packet from MAC, the received timestamp has already beenembedded within the messages. No extra tasks are needed, which reducesthe interrupt handling overhead and ensures the whole system's stabilityand scalability.

FIG. 10 schematically illustrates the entire sending-receiving chain inthe new MAC-layer timestamping approach according to the principles ofthe present invention. In transmission-side (sending) 310, a timesynchronization message is first generated and forwarded to. MAC layer320. The time synchronization message is subsequently forwarded from MAClayer 320 to PHY layer 330. In PHY layer 330, the sending timestamp iscaptured right before the time synchronization message is written intoTxFIFO data buffer. And then, the time synchronization message is sentout and transmitted to other nodes. In receiving side 340, the timesynchronization message is first received at PHY layer 330. In PHY layer330, the receiving timestamp is cached when a receiving SFD interrupt iscreated. A MPDU packet is generated with the captured timestamp as anextra field. The MPDU packet is forwarded from PHY layer 330 to MAClayer 320. In MAC layer 320, the receiving timestamp is embedded intothe time synchronization message's corresponding field. Then, the timesynchronization message is forwarded from MAC layer 320 to a TimeSynchronization module.

We evaluated the performance of the Time Synchronization module. Theresults show that our MAC layer timestamping based time synchronizationmethod supports high accuracy synchronization. We tested 1-hop, 2-hopand 3-hop synchronization accuracy with the time synchronizationinterval of 12 sec (Table 2). If the timer tick supports 1 us, thehighest accuracy can be 9.16 us.

TABLE 2 Synchronization Accuracy Num of Hops Accuracy (ticks) 1-hop 9.16 tick 1-hop 14.55 tick 3-hop 15.80 tick

We also performed stability test by setting up a 12-node test bed. Weused 83 sec time synchronization interval and the test running period of4 hours. FIG. 11 schematically illustrates the system used forperforming the stability test. A sensor node 501 is illustrated as thewireless node with the antenna. Computer 503 monitors the testingprocess. For example, the computer monitors SINK node 502, which is aspecial sensor node that periodically sends out a synchronizationmessage. Each sensor node in the system is run with TinyOS-2.0 IEEE802.15.4 MAC/PHY layers and TinyOS 2.0-based UMR software system. Sincethe UMR software system consists of multiple modules (e.g. TimeSynchronization Module, Topology Control Module, Mesh Routing Module,Data Centric Forwarding Modules), each sensor node in the system hasmultiple modules simultaneously running. During the whole test period,the whole system remains stable and synchronized.

FIG. 12 schematically illustrates major components within a wirelesssensor node for implementing the MAC-layer timestamping method as anembodiment according to the principles of the present invention. Asshown in FIG. 12, wireless sensor node 600 is constructed with a Staticrandom access memory (SRAM) memory unit 601, a special function register(SFR) register 602, a radio frequency (RF) register 603, and a flashmemory unit 604. Static random access memory (SRAM) memory unit 601stores MAC/PHY data (the MPDU packet), Operation system (OS) executiondata, FIFO data (received message), timer data (timestamp), sensor data,and UMR data. SFR register 602 stores hardware setting data. Radiofrequency (RF) register 603 stores radio configuration data. Flashmemory stores hardware driver code (hardware setting values), OSexecution code, 802.15.4 MAC/PHY execution code, and UMR softwareexecution code.

Our time synchronization module is the first implementation thatrealizes MAC layer time-stamping-based time synchronization for the WSNwith the emerging 8051 platform and IEEE 802.15.4 stack. All theexisting MAC layer time-stamping approaches of time synchronization haveonly been implemented in Mica Atmel (AVR) MCU platform/Telos TI MSP430MCU platform, and TinyOS default communication stack. Here we used adifferent approach from traditional MAC layer timestamping approach. NoSFD signal events are specifically created for time synchronization. Allthe sending/receiving time-stampings are embedded and written intopackets within IEEE 802.15.4 layers. Hence our MAC layer time-stampingapproach has minimal overhead to the PHY/MAC layer to ensure the wholesystem performance and has interoperability with other modules in alarge system and also ensures stability at the same time.

1. A method for communication in a wireless network, the methodcomprising: receiving a message at a physical layer of a wireless sensornode, with the message comprising a Start-of-Frame-Delimiter field;capturing a receiving timestamp at an end of receiving theStart-of-Frame-Delimiter field when a Start-of-Frame-Delimiter interruptis created; generating, in the physical layer, a medium access controlprotocol data unit packet comprising the message and a timestampingfield; inserting the captured receiving timestamp in the timestampingfield of the medium access control protocol data unit packet; andforwarding the medium access control protocol data unit packet from thephysical layer of the wireless sensor node to a medium access controllayer of the wireless sensor node.
 2. The method of claim 1 furthercomprising: determining, in the medium access control layer, whether themessage in the medium access control protocol data unit packet is a timesynchronization message; and when the message in the data packet is atime synchronization message, inserting the receiving timestamp into atimestamping field of the time synchronization message, and transmittingthe time synchronization message from the medium access control layer ofthe wireless sensor node to a Time Synchronization module of thewireless sensor node.
 3. The method of claim 1 further comprising:generating a time synchronization message in a time synchronizationmodule of the wireless sensor node and transmitting the timesynchronization message to the medium access control layer of thewireless sensor node.
 4. The method of claim 3 further comprising:forwarding the time synchronization message from the medium accesscontrol layer of the wireless sensor node to the physical layer of thewireless sensor node.
 5. The method of claim 4 further comprising:writing the time synchronization message into a transmit first in, firstout (TxFIFO) data buffer, with a sending timestamp being captured andembedded into the time synchronization message immediately before thetime synchronization message is written into the TxFIFO data buffer; andtransmitting the time synchronization message embedded with the sendingtimestamp from the TxFIFO data buffer.
 6. A method for communication ina wireless network, the method comprising: generating a timesynchronization message in a time synchronization module of a wirelesssensor node and transmitting the time synchronization message to amedium access control layer of the wireless sensor node; forwarding thetime synchronization message from the medium access control layer of thewireless sensor node to a physical layer of the wireless sensor node;writing the time synchronization message into a transmit first in, firstout (TxFIFO) data buffer, with a sending timestamp being captured andembedded into the time synchronization message immediately before thetime synchronization message is written into the TxFIO data buffer; andtransmitting the time synchronization message embedded with the sendingtimestamp from the TxFIFO data buffer.
 7. The method of claim 6 furthercomprising: receiving a message at the physical layer of the wirelesssensor node; generating, in the physical layer, a medium access controlprotocol data unit packet comprising the message and a timestampingfield indicating a receiving timestamp; and forwarding the medium accesscontrol protocol data unit packet from the physical layer of thewireless sensor node to the medium access control layer of the wirelesssensor node.
 8. The method of claim 6 further comprising: receiving amessage at the physical layer of the wireless sensor node, with themessage comprising a Start-of-Frame-Delimiter field; capturing areceiving timestamp at the end of receiving the Start-of-Frame-Delimiterfield when a Start-of-Frame-Delimiter interrupt is created; andgenerating, in the physical layer, a medium access control protocol dataunit packet comprising the message and a timestamping field.
 9. Themethod of claim 8 further comprising: inserting the captured receivingtimestamp in the timestamping field of the medium access controlprotocol data unit packet.
 10. The method of claim 9 further comprising:forwarding the medium access control protocol data unit packet from thephysical layer of the wireless sensor node to the medium access controllayer of the wireless sensor node.
 11. A wireless sensor node in awireless network, comprising: a static random access memory unitcomprising a transmit first in, first out (TxFIFO) data buffer; and aflash memory unit storing instructions configured to generate a timesynchronization message in a time synchronization module, transmit thetime synchronization message to a medium access control layer of thewireless sensor node, forward the time synchronization message from themedium access control layer of the wireless sensor node to a physicallayer of the wireless sensor node, capture a sending timestamp, embedthe captured sending timestamp in the time synchronization message,write the time synchronization message into the TxFIFO data buffer, andtransmit the timestamp embedded with the time synchronization messagefrom the TxFIFO data buffer.
 12. The wireless sensor node of claim 11,wherein the flash memory unit further stores instructions configured toreceive a message at the physical layer of a wireless sensor node, andgenerate a medium access control protocol data unit packet comprisingthe message and a timestamping field indicating a receiving timestamp.13. The wireless sensor node of claim 12, wherein the flash memory unitfurther stores instructions configured to forward the medium accesscontrol protocol data unit packet from the physical layer of thewireless sensor node to the medium access control layer of the wirelesssensor node.
 14. The wireless sensor node of claim 13, wherein the flashmemory unit further stores instructions configured to determine whetherthe message in the medium access control protocol data unit packet is atime synchronization message.
 15. The wireless sensor node of claim 14,wherein the flash memory unit further stores instructions configured toinsert the receiving timestamp into a timestamping field of the timesynchronization message when the message in the data packet is a timesynchronization message, and transmit the time synchronization messagefrom the medium access control layer of the wireless sensor node to theTime Synchronization module of the wireless sensor node.
 16. A wirelesssensor node in a wireless network, comprising: a static random accessmemory unit comprising a transmit first in, first out (TxFIFO) databuffer; and a flash memory unit storing instructions configured togenerate a time synchronization message in a time synchronizationmodule, transmit the time synchronization message to a medium accesscontrol layer of the wireless sensor node, forward the timesynchronization message from the medium access control layer of thewireless sensor node to a physical layer of the wireless sensor node,write the time synchronization message into the TxFIFO data buffer, andtransmit the timestamp embedded with the time synchronization messagefrom the TxFIFO data buffer, with the time synchronization messageincluding a sending timestamp captured and embedded in the timesynchronization message immediately before the time synchronizationmessage is written into the TxFIFO data buffer.
 17. The wireless sensornode of claim 16, wherein the flash memory unit further storesinstructions configured to receive a message at the physical layer of awireless sensor node, and generate a medium access control protocol dataunit packet comprising the message and a timestamping field indicating areceiving timestamp.
 18. The wireless sensor node of claim 17, whereinthe flash memory unit further stores instructions configured to forwardthe medium access control protocol data unit packet from the physicallayer of the wireless sensor node to the medium access control layer ofthe wireless sensor node.
 19. The wireless sensor node of claim 18,wherein the flash memory unit further stores instructions configured todetermine whether the message in the medium access control protocol dataunit packet is a time synchronization message.
 20. The wireless sensornode of claim 19, wherein the flash memory unit further storesinstructions configured to inserting the receiving timestamp into atimestamping field of the time synchronization message when the messagein the data packet is a time synchronization message, and transmit thetime synchronization message from the medium access control layer of thewireless sensor node to the Time Synchronization module of the wirelesssensor node.